package structs_pointer

import "fmt"

type Subcriber struct {
	name   string
	Rate   float64
	active bool
}

func PrintInfo(s *Subcriber) { //获取指针
	fmt.Println("Name: ", s.name)
	fmt.Println("Monthly rate: ", s.Rate)
	fmt.Println("Active?", s.active)
}

func DefaultSubscriber(name string) *Subcriber { //默认状态
	var s Subcriber
	s.name = name
	s.Rate = 5.99
	s.active = true

	return &s //返回一个指向struct的指针
}

func ApplyDiscount(s *Subcriber) {
	s.Rate = 4.99
}
